import 'package:backend.purchases/domain/entities/yookassa_api/payments/yookassa_api_succeeded_payment.dart';

abstract class IsYookassaApiSucceededPaymentRevoked {
  bool call({
    required YookassaApiSucceededPayment apiPayment,
  });
}

class IsYookassaApiSucceededPaymentRevokedImpl implements IsYookassaApiSucceededPaymentRevoked {
  const IsYookassaApiSucceededPaymentRevokedImpl();

  @override
  bool call({
    required YookassaApiSucceededPayment apiPayment,
  }) {
    return RegExp('[1-9]+').hasMatch(apiPayment.refundedAmount.value);
  }
}
